{extend name="public/pure"/}
{block name="style"}
<style>
    .row{margin: 10px 0;}
    .layui-input{border: 0px;}
</style>
{/block}
{block name="content"}
<div class="info-header">
    <div class="layui-row row">
        <div class="layui-col-sm3">
            <label class="layui-form-label">品牌</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.sbrand.name_ch}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">计量单位</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.unit.name_ch}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">分类</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.category.name}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">SPU</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.spu}"/>
            </div>
        </div>
    </div>
    <div class="layui-row row">
        <div class="layui-col-sm3">
            <label class="layui-form-label">中文名称</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.name_ch}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">英文名称</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.name_en}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">申报中文</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.declare_ch}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">申报英文</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.declare_en}"/>
            </div>
        </div>
    </div>
    <div class="layui-row row">
        <div class="layui-col-sm3">
            <label class="layui-form-label">申报价格</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.declare_price}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">海关编码</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.hs_code}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">型号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.model}"/>
            </div>
        </div>
        <div class="layui-col-sm3">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.status}"/>
            </div>
        </div>
    </div>
    <div class="layui-row row">
        <div class="layui-col-xs6">
            <label class="layui-form-label">关键词</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.tags}"/>
            </div>
        </div>
        <div class="layui-col-sm6">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" disabled value="{$product.remark}"/>
            </div>
        </div>
    </div>
    <div class="layui-row row">
        <div class="layui-col-sm6">
            <label class="layui-form-label">产品热度</label>
            <div id="product-rate"></div>
        </div>
    </div>
    <div class="layui-row row">
        <div class="layui-col-sm12 row">
            <label class="layui-form-label">描述信息</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" disabled>{$product.describe}</textarea>
            </div>
        </div>
    </div>
</div>
<div class="info-body">
    <div class="layui-row row">
        <h2>变体信息</h2>
        <table class="layui-table text-center">
            <thead>
                <tr>
                    <th>图片</th>
                    <th>SKU</th>
                    <th>属性</th>
                    <th>颜色</th>
                    <th>长(mm)</th>
                    <th>宽(mm)</th>
                    <th>高(mm)</th>
                    <th>净重(g)</th>
                    <th>包装重(g)</th>
                    <th>采购价格</th>
                    <th>备注</th>
                </tr>
            </thead>
            <tbody>
                {foreach $product.stores as $store}
                <tr>
                    <td width="100"><img src="{$store.image_url?:'__PUBLIC__/img/no-photo.png'}"/></td>
                    <td class="copy-text">{$store.sku}</td>
                    <td>{$store.attr}</td>
                    <td>{$store.color}</td>
                    <td>{$store.length}</td>
                    <td>{$store.width}</td>
                    <td>{$store.height}</td>
                    <td>{$store.weight}</td>
                    <td>{$store.package_weight}</td>
                    <td>{$store.price}</td>
                    <td>{$store.remark}</td>
                </tr>
                {/foreach}
            </tbody>
        </table>
    </div>
    <div class="layui-row row">
        <h2>采购信息</h2>
        <table class="layui-table text-center">
            <thead>
            <tr>
                <th><div class="text-left">供应商</div></th>
                <th>状态</th>
                <th>采购类型</th>
                <th>是否优先采购</th>
                <th>起订数量</th>
                <th>采购价格</th>
                <th>预计到货天数</th>
                <th>起重物流费</th>
                <th>采购链接</th>
                <th>备注</th>
            </tr>
            </thead>
            <tbody>
                {foreach $product.purchase as $pur}
                <tr>
                    <td class="text-left">{$pur.producer_name}</td>
                    <td>{$pur.status}</td>
                    <td>{$pur.type}</td>
                    <td>{$pur.is_default}</td>
                    <td>{$pur.min_qty}</td>
                    <td>{$pur.price}</td>
                    <td>{$pur.predict_day}</td>
                    <td>{$pur.start_weight_price}</td>
                    <td>{if !empty($pur.url)}<a target="_blank" href="{$pur.url}"><i class="layui-icon layui-icon-link"></i></a>{/if}</td>
                    <td>{$pur.remark}</td>
                </tr>
                {/foreach}
            </tbody>
        </table>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    //一般直接写在一个js文件中
    layui.use(['layer', 'form', 'rate'], function () {
        var layer = layui.layer
            , $ = layui.jquery
            , rate = layui.rate;

        // 商品热度
        rate.render({
            elem: '#product-rate'
            ,value: "{$product.hot}"
            ,text: true
            ,setText: function(value)
            {
                var arrs = {
                    '1': '普通'
                    ,'2': '一般'
                    ,'3': '中等'
                    ,'4': '好'
                    ,'5': '极好'
                };
                this.span.text(arrs[value] || ( value + "星"));
            }
        });
    });
</script>
{/block}